<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>八大指标统计</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <link href="/static/js/laydate/theme/default/laydate.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        body {
            margin:0;
            padding:0;
            border:0;
            width:100%;
            height:99%;
            overflow:hidden;
        }
    </style>
</head>
<body>

<div class="role-search">
    <div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;">
        <table>
            <tr>
                <td style="white-space: nowrap;text-align:right;">
                    <a class="mini-button" plain="true" iconCls="fa fa-search" plain="true" onclick="search()">统计</a>
                    <a class="mini-button" iconCls="fa-folder-open-o" plain="true" onclick="exportExcelFile()">导出</a>
                </td>
            </tr>
        </table>
    </div>
</div>

<!--撑满页面-->
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;" ajaxType="get" multiSelect="false"
         sizeList="[20,50,100]" pageSize="100" virtualScroll="true" showPager="false"
         idField="id" url="/azbj/statisticalreports/info/bdlist" showSummaryRow="true" allowAlternating="true" frozenStartColumn="0" ondrawsummarycell="onDrawSummaryCell">
        <div property="columns">
            <#if level ?? && level ="06">
                <div header="各地市" field="childs" headerAlign="center"></div>
            </#if>
            <#if level ?? && level ="07">
                <div header="各区县" field="childs" headerAlign="center"></div>
            </#if>
            <#if level ?? && level ="08">
                <div header="各司法所" field="childs" headerAlign="center"></div>
            </#if>
            <div header="数据指标统计(说明:当前统计项仅为系统上线使用后新录入数据情况统计)" headerAlign="center">
                <div property="columns">
                    <div width="120" headerAlign="center">核查指标
                        <div property="columns">
                            <div field="lrrs" width="85" cellStyle="background-color: peachpuff;">录入总人数</div>
                            <div field="lrrs_jy" width="110" cellStyle="background-color: papayawhip;">监狱录入总人数</div>
                            <div field="lrrs_kss" width="125" cellStyle="background-color: papayawhip;">看守所录入总人数</div>
                            <div field="lrrs_sj" width="110" cellStyle="background-color: papayawhip;">社矫录入总人数</div>
                            <div field="hczrs" width="110" cellStyle="background-color: peachpuff;">发起核查总人数</div>
                            <div field="hczrs_jy" width="145" cellStyle="background-color: papayawhip;">监狱发起核查总人数</div>
                            <div field="hczrs_kss" width="155" cellStyle="background-color: papayawhip;">看守所发起核查总人数</div>
                            <div field="hczrs_sj" width="145" cellStyle="background-color: papayawhip;">社矫发起核查总人数</div>
                            <div field="wchczrs" width="110" cellStyle="background-color: peachpuff;">完成核查总人数</div>
                            <div field="wchczrs_jy" width="150" cellStyle="background-color: papayawhip;">完成核查总人数(监狱)</div>
                            <div field="wchczrs_kss" width="165" cellStyle="background-color: papayawhip;">完成核查总人数(看守所)</div>
                            <div field="wchczrs_sj" width="150" cellStyle="background-color: papayawhip;">完成核查总人数(社矫)</div>
                            <div field="hccgs" width="90">核查成功数</div>
                            <div field="hcl" width="125">发起核查率<br><font size="0.1px">(发起核查总人数<br> ÷录入总人数)</font></div>
                            <div field="wchcl" width="125">完成核查率<br><font size="0.1px">(完成核查总人数<br> ÷发起核查总人数)</font></div>
                            <div field="hccgl" width="125">核查成功率<br><font size="0.1px">(核查成功数<br> ÷发起核查总人数)</font></div>
                        </div>
                    </div>
                    <div width="120" headerAlign="center">衔接指标
                        <div property="columns">
                            <div field="xjzs" width="85" cellStyle="background-color: peachpuff;">衔接总人数</div>
                            <div field="xjzs_jy" width="125" cellStyle="background-color: papayawhip;">衔接总人数(监狱)</div>
                            <div field="xjzs_kss" width="135" cellStyle="background-color: papayawhip;">衔接总人数(看守所)</div>
                            <div field="xjzs_sj" width="125" cellStyle="background-color: papayawhip;">衔接总人数(社矫)</div>
                            <div field="xjcgs" width="110">衔接成功总人数</div>
                            <div field="xjl" width="125">衔接成功率<br><font size="0.1px">(衔接成功总人数<br> ÷衔接总人数)</font></div>
                        </div>
                    </div>
                    <div width="120" headerAlign="center">安置指标
                        <div property="columns">
                            <div field="azzs" width="70">安置总数</div>
                            <div field="azl" width="145">安置率<br><font size="0.2px">(安置总数<br> ÷衔接成功总人数)</font></div>
                        </div>
                    </div>
                    <div width="120" headerAlign="center">帮教指标
                        <div property="columns">
                            <div field="bjzs" width="70">帮教总数</div>
                            <div field="bjl" width="145">帮教率<br><font size="0.2px">(帮教总数<br> ÷衔接成功总人数)</font></div>
                        </div>
                    </div>
                    <div width="120" headerAlign="center">救助指标
                        <div property="columns">
                            <div field="jzzs" width="70">救助人数</div>
                            <div field="jzl" width="145">救助率<br><font size="0.2px">(救助总数<br> ÷衔接成功总人数)</font></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/js/laydate/laydate.js" type="text/javascript"></script>
<script type="text/javascript">

    mini.parse();
    var grid = mini.get("datagrid1");
    mini.DataGrid.prototype.defaultRowHeight=40;
    //用于计算率
    var fqhczrs = 0;
    var lrzrs = 0;
    var wchczrs = 0;
    var hccgs = 0;
    var xjcgzrs = 0;
    var xjzrs = 0;
    var azzs = 0;
    var bjzs = 0;
    var jzzs = 0;

    grid.setFrozenStartColumn(0);
    grid.setFrozenEndColumn(0);

    function exportExcelFile() {
        var json = mini.encode(grid.data);
        if (json == '') {
            return;
        }
        top.location.href = encodeURI("/azbj/statisticalreports/exportExcelBdFile?data=1");
    }

    //查询-从数据库中获取
    function search() {
        grid.load({yearKey:'-1'});
    }
    //页面加载从redis中获取
    $(function () {
        grid.load({yearKey:'1'});
    });

    //添加合计行
    function onDrawSummaryCell(e) {
        var result = e.result;
        var grid = e.sender;
        var rows = e.data;

        if (e.field == "childs") {
            e.cellHtml = "合计: ";
        }

        if (e.field == "lrrs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.lrrs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            lrzrs = total;
            e.cellHtml = total;
        }
        if (e.field == "lrrs_jy") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.lrrs_jy;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "lrrs_kss") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.lrrs_kss;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "lrrs_sj") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.lrrs_sj;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "hczrs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.hczrs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            fqhczrs = total;
            e.cellHtml = total;
        }
        if (e.field == "hczrs_jy") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.hczrs_jy;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "hczrs_kss") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.hczrs_kss;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "hczrs_sj") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.hczrs_sj;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "wchczrs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.wchczrs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            wchczrs = total;
            e.cellHtml = total;
        }
        if (e.field == "wchczrs_jy") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.wchczrs_jy;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "wchczrs_kss") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.wchczrs_kss;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "wchczrs_sj") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.wchczrs_sj;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "hccgs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.hccgs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            hccgs = total;
            e.cellHtml = total;
        }
        if (e.field == "xjzs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.xjzs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            xjzrs = total;
            e.cellHtml = total;
        }
        if (e.field == "xjzs_jy") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.xjzs_jy;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "xjzs_kss") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.xjzs_kss;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "xjzs_sj") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.xjzs_sj;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            e.cellHtml = total;
        }
        if (e.field == "xjcgs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.xjcgs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            xjcgzrs = total;
            e.cellHtml = total;
        }
        if (e.field == "azzs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.azzs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            azzs = total;
            e.cellHtml = total;
        }
        if (e.field == "bjzs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.bjzs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            bjzs = total;
            e.cellHtml = total;
        }
        if (e.field == "jzzs") {
            var total = 0;
            for (var i = 0, l = rows.length; i < l; i++) {
                var row = rows[i];
                var t = row.jzzs;
                if (isNaN(t)) continue;
                total += Number(t);
            }
            jzzs = total;
            e.cellHtml = total;
        }

        if (e.field == "hcl") {
            var total = Number(fqhczrs*100/lrzrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
        if (e.field == "wchcl") {
            var total = Number(wchczrs*100/fqhczrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
        if (e.field == "hccgl") {
            var total = Number(hccgs*100/fqhczrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
        if (e.field == "xjl") {
            var total = Number(xjcgzrs*100/xjzrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
        if (e.field == "azl") {
            var total = Number(azzs*100/xjcgzrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
        if (e.field == "bjl") {
            var total = Number(bjzs*100/xjcgzrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
        if (e.field == "jzl") {
            var total = Number(jzzs*100/xjcgzrs).toFixed(2)
            if (total == 100) {
                total = 100;
            }
            total += '%';
            e.cellHtml = total;
        }
    }


</script>
<script src="/static/js/common/common.js" type="text/javascript"></script>
</body>
</html>